%% ����ɸѡ��׼
index=sort(dp1(:));%dp1�Ǹ���fingerprint-weight�õ���Ȩ�ؾ�����һ���������ҵ������Ǹ�������ɾ������Ϊ�����������ӡ�
a=max(index);%�ҵ�������ġ�
index(index==a)=[];%ɾ��
a=max(index);%��������ֵ
b=[100:-1:2];%���涨�����͹��˷�Χ
for iii=1:length(b)
spacity(iii)=prctile(index,b(iii));%Ѱ�Ҷ�Ӧ�İٷ�λ����������һ��ɸѡ��׼
end
%% ׼����������
lengthspa=length(spacity);%�趨ѭ������
all_mat_or=cat(3,all_default_se1,all_default_se2);%�㶨ԭʼ���󣬽�ǰ������ϲ���һ����ά����ǰ��ά�Ǿ��󣬵���ά�Ǳ�����
[x,y,z]=size(all_mat_or);%��Ҫ�õ���ά�ȳ���

all_mat_or=reshape(all_mat_or,[x*y,z]);
all_mat_or=all_mat_or';%��FC������ƽ����ά�����ɶ�ά����
 
group1_number=size(all_default_se1,3);%��һ�������
group2_number=size(all_default_se2,3);%�ڶ��������
total_number=group1_number+group2_number;%������

for ii=1:lengthspa
        dp2=dp1;
        dp2(dp2>spacity(ii))=0; 
        dp2(dp2~=0)=1;
        dp3=dp2(:)';
        mask_index1(ii,:)=dp3;
        dp4=repmat(dp3,z,1);
        all_mat(:,:,ii)=dp4.*all_mat_or;
end 
%%
h=waitbar(0,'Game start')
for j=1:lengthspa
     all_mat_1= all_mat(:,:,j);
     [all_mat_1 CP]=mapminmax(all_mat_1, -1,1);
     [Accuracy,p_Accuracy]=shit2(all_mat_1,10,group1_number,group2_number);
     AA_acc_baniry(j)=Accuracy(1);
     AA_p_vlaue(j)=p_Accuracy;
     waitbar(j/lengthspa,h,[num2str(j),'/',num2str(lengthspa)])
     clear all_mat_1
end
close(h)
b=100-b;
plot(b,AA_acc_baniry)